package com.hongyun.tms.common.dto.tug;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hongyun.tms.common.annotation.Dict;
import com.hongyun.tms.infra.excel.converter.LocalDateTimeOrDateConverter;
import com.hongyun.tms.infra.excel.converter.dict.DictConverter;
import com.hongyun.tms.infra.excel.converter.enums.TugStatusEnumConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * 拖轮 导入参数
 *
 * @author liPeng
 * @date 2024-05-31
 **/
@Data
public class TugImportDto implements Serializable {

    @ApiModelProperty(value = "拖轮名称")
    @ExcelProperty(value = "拖轮名称", index = 0)
    @NotBlank(message = "拖轮名称不能为空")
    @Size(max = 40, message = "拖轮名称不能超过40给字符")
    private String tugName;

    @ApiModelProperty(value = "拖轮编号")
    @ExcelProperty(value = "拖轮编号", index = 1)
    @NotBlank(message = "拖轮编号不能为空")
    @Size(max = 30, message = "拖轮编号不能超过30给字符")
    private String tugNo;

    @ApiModelProperty(value = "拖轮状态，0适航1不适航2停修")
    @ExcelProperty(value = "拖轮状态", index = 2, converter = TugStatusEnumConverter.class)
    @NotNull(message = "拖轮状态不能为空")
    private Integer staus;

    @ApiModelProperty(value = "拖轮类型代码，字典")
    @Dict(code = "TUG_TYPE")
    @ExcelProperty(value = "拖轮类型", index = 3, converter = DictConverter.class)
    @NotBlank(message = "拖轮类型不能为空")
    @Size(max = 20, message = "拖轮类型不能超过20个字符")
    private String tugTypeCode;

    @ApiModelProperty(value = "注册港")
    @ExcelProperty(value = "注册港", index = 4)
    @Size(max = 40, message = "注册港不能超过40个字符")
    private String registryPort;

    @ApiModelProperty(value = "经营人")
    @Size(max = 40, message = "经营人不能超过40个字符")
    @ExcelProperty(value = "经营人", index = 5)
    private String operator;

    @ApiModelProperty(value = "所有人")
    @Size(max = 40, message = "所有人不能超过40个字符")
    @ExcelProperty(value = "所有人", index = 6)
    private String owner;

    @ApiModelProperty(value = "建造日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ExcelProperty(value = "建造日期", index = 7, converter = LocalDateTimeOrDateConverter.class)
    private LocalDate buildDate;

    @ApiModelProperty(value = "建造厂家")
    @Size(max = 40, message = "建造厂家不能超过40个字符")
    @ExcelProperty(value = "建造厂家", index = 8)
    private String buildFactory;

    @ApiModelProperty(value = "IMO")
    @Size(max = 25, message = "IMO不能超过25个字符")
    @ExcelProperty(value = "IMO", index = 9)
    private String imo;

    @ApiModelProperty(value = "呼号")
    @Size(max = 20, message = "呼号不能超过20个字符")
    @ExcelProperty(value = "呼号", index = 10)
    private String callNo;

    @ApiModelProperty(value = "船舶识别号")
    @Size(max = 20, message = "船舶识别号不能超过20个字符")
    @ExcelProperty(value = "船舶识别号", index = 11)
    private String idNo;

    @ApiModelProperty(value = "船舶登记号")
    @Size(max = 20, message = "船舶登记号不能超过20个字符")
    @ExcelProperty(value = "船舶登记号", index = 12)
    private String regNo;

    @ApiModelProperty(value = "总长")
    @DecimalMax(value = "999", message = "总长不能超过999")
    @DecimalMin(value = "0", message = "总长不能小于0")
    @ExcelProperty(value = "建造厂家", index = 13)
    private BigDecimal tugLength;

    @ApiModelProperty(value = "型宽")
    @DecimalMax(value = "999", message = "型宽不能超过999")
    @DecimalMin(value = "0", message = "型宽不能小于0")
    @ExcelProperty(value = "型宽", index = 14)
    private BigDecimal tugWidth;

    @ApiModelProperty(value = "型深")
    @DecimalMax(value = "999", message = "型深不能超过999")
    @DecimalMin(value = "0", message = "型深不能小于0")
    @ExcelProperty(value = "型深", index = 15)
    private BigDecimal tugDepth;

    @ApiModelProperty(value = "主机功率")
    @Size(max = 8, message = "主机功率不能超过8个字符")
    @ExcelProperty(value = "主机功率", index = 16)
    private String power;

    @ApiModelProperty(value = "马力")
    @Size(max = 8, message = "马力不能超过8个字符")
    @ExcelProperty(value = "马力", index = 17)
    private String horsepower;

    @ApiModelProperty(value = "总吨")
    @DecimalMax(value = "99999", message = "总吨不能超过99999")
    @DecimalMin(value = "0", message = "总吨不能小于0")
    @ExcelProperty(value = "总吨", index = 18)
    private BigDecimal totalTon;

    @ApiModelProperty(value = "净吨")
    @DecimalMax(value = "99999", message = "净吨不能超过99999")
    @DecimalMin(value = "0", message = "净吨不能小于0")
    @ExcelProperty(value = "净吨", index = 19)
    private BigDecimal netTon;

    @ApiModelProperty(value = "满载吃水")
    @DecimalMax(value = "99", message = "满载吃水不能超过99999")
    @DecimalMin(value = "0", message = "满载吃水不能小于0")
    @ExcelProperty(value = "满载吃水", index = 20)
    private BigDecimal draftFull;

    /**
     * 空载吃水
     */
    @ApiModelProperty(value = "空载吃水")
    @DecimalMax(value = "99", message = "空载吃水不能超过99999")
    @DecimalMin(value = "0", message = "空载吃水不能小于0")
    @ExcelProperty(value = "空载吃水", index = 21)
    private BigDecimal draftEmpty;

    @ApiModelProperty(value = "作业港区代码,字典")
//    @Dict(code = "PORT_AREA")
//    @ExcelProperty(value = "作业港区", index = 22, converter = DictConverter.class)
    @ExcelIgnore
    private String portAreaCode;

    @ApiModelProperty(value = "作业港区代码,str")
    @ExcelIgnore
    private String portAreaName;
}

